import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import FundListView from '../views/FundListView.vue'
import FundScoreCardView from '../views/FundScoreCardView.vue'

const routes = [
  {
    path: '/',
    name: 'root',
    redirect: '/funds'
  },
  {
    path: '/funds',
    name: 'home',
    component: FundListView
  },
  {
    path: '/search',
    name: 'search',
    component: HomeView
  },
  {
    path: '/fund/:fundCode/scorecard',
    name: 'fund-score-card',
    component: FundScoreCardView
  },
  // 保留以下路由用于兼容性
  {
    path: '/fund/:id',
    name: 'fundDetail',
    component: () => import('../views/FundDetailView.vue')
  },
  {
    path: '/fund/:id/performance',
    name: 'fundPerformance',
    component: () => import('../views/FundPerformanceView.vue')
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router